package com.cy.store.repository;

import com.cy.store.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.ModelAttribute;


import java.util.Date;

public interface UserRepository extends JpaRepository<User, Integer> {
    User findByUsername(String name);

    @Modifying
    @Transactional
    @Query(value = "update user set avatar=?2, modified_user=?3, modified_time=?4 where uid=?1 ",nativeQuery = true)
    Integer updateAvatarByUid(Integer uid, String avatar, String modifiedUser, Date modifiedTime);


}
